package ar.com.ford.it.fullEconomics.init;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import com.ford.it.exception.FjfConfigurationException;
import com.ford.it.presentation.taglib.menu.Menu;

/*******************************************************************************
 * load menu content from 'menu-content.xml' file; using default property group
 * name 'FullEconomic' store the menu instance in application context, using the
 * menu name as key
 ******************************************************************************/

public class MenuInitServlet extends HttpServlet {

    public void init() throws ServletException {
        super.init();

        try {
            Menu menu = new Menu();
            menu.load("menu-definiton.xml");
            getServletContext().setAttribute(menu.getName(), menu);

        } catch (FjfConfigurationException e) {
            throw new ServletException("Exception occurred.", e);
        }
    }
}